package fr.insta.reverse.uml.bean;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * @author Valera
 *
 */
@Entity
@Table(name = "vote",
		catalog = "reverseUml")
public class Vote implements Serializable
{
	@Id
	@ManyToOne
	@JoinColumn(name = "vote_usr")
	private User user;

	@Id
	@ManyToOne
	@JoinColumn(name = "vote_guide")
	private Guide guide;

	@Column(name = "vote_note")
	private int note;

	public Vote()
	{
	}

	public Vote(User user, Guide guide, int note)
	{
		this.user = user;
		this.guide = guide;
		this.note = note;
	}

	public User getUser()
	{
		return user;
	}

	public void setUser(User user)
	{
		this.user = user;
	}

	public Guide getGuide()
	{
		return guide;
	}

	public void setGuide(Guide guide)
	{
		this.guide = guide;
	}

	public int getNote()
	{
		return note;
	}

	public void setNote(int note)
	{
		this.note = note;
	}

	@Override
	public String toString()
	{
		return guide.getLib() + ", " + user.getPrenom() + " " + user.getNom() + ", " + note;
	}
}
